
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>
#include <Square.h>
#include <iostream>
#include <math.h>

#define FLT_EPSILON  exp(-32)

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Square)			
{

	TEST(should be able to compute the square area with float parameter)
	{
		Square<float> square(5.0);   
 
		ASSERT_EQ(25.0, square.computeArea()); 
	}

        TEST(should be able to compute the square Area with double parameter)
        {
                Square<double> square(1.88);

                ASSERT_DELTA(3.5344, square.computeArea(), FLT_EPSILON);
        }



	TEST(should be able to compute the square Perimeter with float parameter)
	{
		Square<float> square(5.0);
  
		ASSERT_EQ(20.0, square.computePerimeter());
	}

        TEST(should be able to compute the square Perimeter with double parameter )
        {
                Square<double> square(4.33333333333333);
  
                ASSERT_EQ(17.33333333333332, square.computePerimeter());
        }

        
	TEST(should be able to check whether the square area and perimeter is valid when inputing invalid integer parameter ) 
        {
                Square<int> square(-5);
                ASSERT_EQ(INVALIDATTRIBUTE, square.computeArea());
                ASSERT_EQ(INVALIDATTRIBUTE, square.computePerimeter());
        }

 
  	TEST(should be able to compute the square area when changing the length of Square side) 
        {
                Square<int> square(3);
                ASSERT_EQ(9, square.computeArea());
 
                square.setSide(4);
                ASSERT_EQ(16, square.computeArea());

 
        }

  	TEST(should be able to compute the square perimeter when changing the length of Square side) 
        {
                Square<int> square(3);
                ASSERT_EQ(12, square.computePerimeter());

                square.setSide(4);
                ASSERT_EQ(16, square.computePerimeter());
 
        }

};
